package com.itxuhang.order.feign;

import com.itxuhang.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

//ip:port
// 结合NacosDiscovery去根据服务名获取服务提供者的连接信息
@FeignClient("item-service")
public interface ItemService {

    //http://item-service/item/1
    @GetMapping("/item/{id}")
    Item findUserById(@PathVariable Integer id);
    /*
    String url = "http://item-service/item/"+id;
    Item item = restTemplate.getForObject(url,Item.class);
    */

    @PostMapping("/item")
    void saveItem(Item item);
}
